package com.lsh.payment.core.model.payenum;

import java.util.HashMap;
import java.util.Map;

/**
 * 退款任务状态
 * @author peter
 */
public enum RefundTaskStatus {
    /**
     *
     */
    TASK_NEW(1, "新建"),
    TASK_SUCCESS(2, "执行成功"),
    TASK_FAIL(3, "执行失败");

    private int value;
    private String name;

    RefundTaskStatus(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    public static RefundTaskStatus getPayStatus(int status) {
        for (RefundTaskStatus it : RefundTaskStatus.values()) {
            if (it.getValue() == status) {
                return it;
            }
        }
        return null;
    }

    private static Map<Integer, String> RefundTaskTypeMap = new HashMap<>(RefundTaskStatus.values().length * 2);

    static {
        for (RefundTaskStatus payStatus : RefundTaskStatus.values()) {
            RefundTaskTypeMap.put(payStatus.getValue(), payStatus.getName());
        }
    }

    public static Map<Integer, String> getRefundTaskTypeMap() {
        return RefundTaskTypeMap;
    }
}
